<include file="./Tpl/Home/Header.html"/>
<link href="/Public/Home/bootstrap.min.css?v=3.4.0" rel="stylesheet">
<script src="/Public/Home/bootstrap.min.js?v=3.4.0"></script>
<!-- jQuery Validation plugin javascript-->
<script src="/Public/js/jquery.validate.min.js"></script>
<script src="/Public/js/messages_zh.min.js"></script>
<script src="/Public/js/base.js"></script>
<style type="text/css">
.buttonGreen2 {
	background: none repeat scroll 0 0 #068814;
	color: #FFFFFF;
	display: inline-block;
	font-size: 14px;
	font-weight: 700;
	height: 32px;
	line-height: 32px;
	margin-top: 5px;
	margin-bottom: 5px;
	text-align: center;
	width: 100px;
}
.buttonGray2 {
	background: none repeat scroll 0 0 gray;
	color: #FFFFFF;
	display: inline-block;
	font-size: 14px;
	font-weight: 700;
	height: 32px;
	line-height: 32px;
	margin-top: 5px;
	margin-bottom: 5px;
	text-align: center;
	width: 120px;
}
.buybtc-subscription {
	float: left;
	height: 200px;
	width: 777px;
}
.buybtc-subscription2 {
	float: left;
	height: 300px;
	width: 777px;
}
.buybtcbody-subscription {
	height: 242px;
}
.finger_img {
	margin-bottom: 35px;
	margin-left: 278px;
	margin-top: -450px;
}
.finger_img1 {
	margin-bottom: 28px;
	margin-left: 13px;
	margin-top: -521px;
}
td {
	text-align: center;
	border-bottom:1px solid #e4e4e4;
}

.buysellinput-2 {
	border: 1px solid #e1e1e1;
	height: 20px;
	line-height: 30px;
	width: 30px;
}
.coinBoxBody th{ text-align:center}
.coinBoxBody td{ height:40px !important}
.error{ color:#C00}
</style>

<div class="marketArea clear"> <include file="./Tpl/Home/Left.html"/>
  <div class="rightArea">
    <div class="buysellTitle">
      <div class="selecttab1">
        <ul class="selecttab-box1">
          <li > <a href="?s=Home/Jishi/index" class="otherBoxTitle">市场</a> </li>
          <li class="cur"> <a href="?s=Home/Jishi/jiaoyi" class="otherBoxTitle">市场交易</a> </li>
          <li class=""> <a href="?s=Home/Jishi/buylist" class="otherBoxTitle">成交记录</a> </li>
        </ul>
        <input type="hidden" value="0" id="playSymobl">
      </div>
    </div>
    <div style="margin-top: 3px;" class="entrustTen lasttenorder">
      <div class="coinBoxBody"></div>
    </div>
    <div style="margin-top: -30px;" class="entrustTen lasttenorder"> </div>
    <div style="margin-top: 3px;" class="endivustTen lasttenorder">
      <div class="coinBoxBody">
        <table width="100%">
          <tbody>
            <tr>
              <th align="center" >总数量</th>
              <th align="center" >剩余数量</th>
              <th align="center">单价</th>
              <th align="center" >总金额</th>
              <th align="center">佣金比率</th>
              <th align="center" >佣金金额</th>
              <th align="center">委托时间</th>
              <th align="center">操作</th>
            </tr>
            <foreach name='list' item='v'>
              <tr>
            	<td align="center">{$v.num}</td>
                <td align="center">{$v.shengyu_num}</td>
                <td align="center">{$v.price}</td>
                <td align="center">{$v['num']*$v['price']}</td>
                <td align="center">{$v.shouxufei}</td>
                <td align="center">{$v.deal}</td>
                <td align="center">{$v.ctime|date='Y-m-d H:i:s',###}</td>
				<td align="center"><button type="button" class="btn btn-primary  btn-sm" onclick="getshuju(this)" data-toggle="modal" data-target="#myModal">
                                       买入
                                    </button></td>
                                                              <input type="hidden" value="{$v.id}"  name="id"/>

              </tr>
            </foreach>
        </table>
      </div>
      <div class="page">
        <ul>
        </ul>
      </div>
    </div>
  </div>
</div>
<script>
	function getshuju(_this){
		var tr=$(_this).parents("tr");
		var num=tr.children().eq(0).text();	
		var shengyu_num=tr.children().eq(1).text();
		var price=tr.children().eq(2).text();
		var id=tr.find("input[name=id]").val();
		$("#myModal input[name='num']").val(num)
		$("#myModal input[name='shengyu_num']").val(shengyu_num)
		$("#myModal input[name='price']").val(price)
		$("#myModal input[name='id']").val(id)
	}
</script>
<div class="modal inmodal in" id="myModal" tabindex="-1" role="dialog"  aria-hidden="true">
  <div class="modal-dialog modal-lg modal-wrap" style="width:600px">
    <div class="modal-content animated bounceInLeft">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title">购买确认</h4>
        <div class="modal-body">
        	<form class="form-horizontal m-t" id="signupForm" jump-url="/?s=Home/Jishi/jiaoyi" method="post" action="/?s=Home/Jishi/buy">
            <input name="id" type="hidden" value="" />
        <div class="form-group">
                    <label class="col-sm-3 control-label">总数量：</label>
                    <div class="col-sm-8">
                      <input name="num" class="form-control valid" placeholder="填写交易数量" type="text" aria-required="true" aria-invalid="false" readonly="readonly">
                    </div>
                  </div>
                   <div class="form-group">
                    <label class="col-sm-3 control-label">剩余数量：</label>
                    <div class="col-sm-8">
                      <input  name="shengyu_num" class="form-control valid" type="text" aria-required="true" aria-invalid="false"  readonly="readonly">
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-3 control-label">卖出单价：</label>
                    <div class="col-sm-8">
                      <input name="price" class="form-control valid" placeholder="填写出单价" type="text" aria-required="true" aria-invalid="false"   readonly="readonly"value="">
                    </div>
                  </div>
                 <div class="form-group">
                    <label class="col-sm-3 control-label">购买数量：</label>
                    <div class="col-sm-8">
                      <input  name="buy_num" class="form-control valid" type="text" aria-required="true" aria-invalid="false" value="">
                    </div>
                  </div>
                    <div class="form-group">
                    <label class="col-sm-3 control-label">交易密码：</label>
                    <div class="col-sm-8">
                      <input  name="password" class="form-control valid" placeholder="填写交易密码" type="password" aria-required="true" aria-invalid="false" value="">
                    </div>
                  </div>
               <div class="form-group">
                    <div class="col-sm-5 col-sm-offset-3">
                      <button class="btn  btn-block btn-primary" type="submit" id="submit-btn">提交</button>
                    </div>
                  </div>
          
        </form>
         </div>
        </div>
      </div>
    </div>
  </div>
<include file="./Tpl/Home/Footer.html"/> 
<script>	
           $("#signupForm").validate({			   
                rules: {
                    buy_num: {
                        required: true,
						number:true,  
                    },
              
					 password: {
                        required: true,
                    }
                },
                messages: {
                    buy_num: {
                        required: "数量不能为空",
						number:"填写的数量必须是数字",
                    },
					 password: {
                        required: "密码不能为空",
                    }
                },
				submitHandler:function(form){
					ajax_submit_form(form)
					return false;
				},
				invalidHandler: function() {  //不通过回调 
					  return false; 
				  },
		   
            });
			</script>
<script type="text/javascript">

    //显示当前类别样式
    $('#left_main_trance').removeClass().addClass('tradeTitlecur');//一级
    $('#left_main_trance span').removeClass().addClass('trade1cur');
    $('#left_factory').addClass('cur');//二级
</script> 
